Conditions | 1 |
Paths | 1 |
Total Lines | 25 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | module.exports = function (gulp, plugins, config) { |
||
2 | return function htmlmin() { |
||
3 | return gulp.src(config.build + '/*.html') |
||
4 | .pipe(plugins.inject(gulp.src(['config.json']), { |
||
5 | starttag: '<!-- inject:config -->', |
||
6 | transform: function (filePath, file) { |
||
7 | return '<script>var jsonData =' + |
||
8 | file.contents.toString('utf8') |
||
9 | .replace('<!-- inject:cache-breaker -->', |
||
10 | Math.random().toString(12).substring(7)) + |
||
11 | ';</script>' |
||
12 | ; |
||
13 | } |
||
14 | })) |
||
15 | .pipe(plugins.realFavicon.injectFaviconMarkups(JSON.parse(fs.readFileSync(config.faviconData)).favicon.html_code)) |
||
16 | .pipe(plugins.kyhInlineSource({ compress: false })) |
||
17 | .pipe(plugins.cacheBust({ |
||
18 | type: 'timestamp' |
||
19 | })) |
||
20 | .pipe(plugins.htmlmin({ |
||
21 | removeComments: true, |
||
22 | collapseWhitespace: true, |
||
23 | minifyJS: true |
||
24 | })) |
||
25 | .pipe(gulp.dest(config.build)); |
||
26 | }; |
||
27 | }; |
||
28 |